<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath%>js/initNextPage.js"></script>
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>

<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">

</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">


					<div class="clearfix"></div>



					<br />




				</div>
			</div>



			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="page-title">
						<div class="title_left">
							<h3>商品管理</h3>
						</div>

						<div class="title_right">
							
						</div>
					</div>

					<div class="clearfix"></div>

					<div class="row">
						<div class="col-md-12">
							<div class="x_panel">
								<div class="x_title">
									<h2>所有商品</h2>
									<ul class="nav navbar-right panel_toolbox">
										<li><a class="collapse-link"> <i
												class="fa fa-chevron-up"></i>
										</a></li>
										<li class="dropdown"><a href="#" class="dropdown-toggle"
											data-toggle="dropdown" role="button" aria-expanded="false">
												<i class="fa fa-wrench"></i>
										</a>
											<ul class="dropdown-menu" role="menu">
												<li><a href="#">Settings 1</a></li>
												<li><a href="#">Settings 2</a></li>
											</ul></li>
										<li><a class="close-link"> <i class="fa fa-close"></i>
										</a></li>
									</ul>
									<div class="clearfix"></div>
								</div>
								<div class="x_content">
									<select class="btn btn-default dropdown-toggle" id="sort" style="text-align: center;">
										<option value="0" <c:if test="${sort == 0}">selected</c:if>>默认</option>
										<option value="1" <c:if test="${sort == 1}">selected</c:if>>降序</option>
										<option value="2" <c:if test="${sort == 2}">selected</c:if>>升序</option>
									</select>
									<select class="btn btn-default dropdown-toggle" id="goodsClassify" style="text-align: center;"
											onchange="secondCategory()">
										<option value="分类" <c:if test="${classify == 分类}">
											selected</c:if>>分类</option>
										<c:forEach items="${goodsClassify}" var="s" varStatus="z">
											<option value="${s.id}"
													<c:if test="${s.id == classify}">
														selected</c:if>>${s.text}</option>
										</c:forEach>
									</select>
									关键词: <input type="text" name="q" id="q"
												value="${q}" />
									<button type="submit" class="btn btn-default"
											onclick="select(1)">搜索</button>
                                 <div class="row" >
                                   <c:forEach items="${map_data}" var="s" varStatus="z" >
										 <div class="col-md-55">
											<div class="thumbnail">
												<div class="image view view-first">
													<img style="width:100%; display: block;"
														src="${s.pict_url}" alt="image" data-action="zoom"/>
													<div class="mask">
														<p></p>
														<div class="tools tools-bottom">
															<a href="#" title="精选单品" onclick="addChoiceGoods('${s.num_iid}',1)"> <i class="fa fa-circle-o"></i></a>
															<a href="#" title="邀新文案" onclick="addChoiceGoods('${s.num_iid}',2)"> <i class="fa fa-handshake-o"></i></a>
															<a href="#" title="好货专场" onclick="addGoodGoods('${s.num_iid}')"> <i class="fa fa-thumbs-o-up"></i></a>
															<a href="#" title="精选专场" onclick="addChoiceList('${s.num_iid}')"> <i class="fa fa-heart-o"></i></a>
															<a href="#" title="大牌专场" onclick="addTbkBrandList('${s.num_iid}')"> <i class="fa fa-star-half-o"></i></a>
														</div>
													</div>
												</div>
												<div class="caption">
													<p>${s.title}</p>
												</div>
											</div>
										</div>
								   </c:forEach>
								</div>   
                            </div>
						</div>
					</div>
				</div>
				<div style="width: 100%;text-align: center;">
					<div id='page'>
					<c:if test="${curPage > 1 }">
					<input type="button" onclick="previous('${curPage}')" value="上一页"/>
					</c:if>
					<c:if test="${curPage < totlenum }">
					<input type="button" onclick="next('${curPage}')" value="下一页"/>
					</c:if>
					</div>
				</div>
			</div>
			<!-- /page content -->
			<script type="text/javascript">
			function select(curPage) {
				var q = $("#q").val();
				var sort = $("#sort").find("option:selected").val();
				var classify = $("#goodsClassify").find("option:selected").val();
				location.href = "selectCommodities?curPage=" + curPage +
						"&q=" + q +
						"&sort=" + sort +
						"&classify=" + classify;
			}

			function previous(curPage) {
				var q = $("#q").val();
				var sort = $("#sort").find("option:selected").val();
				var classify = $("#goodsClassify").find("option:selected").val();
				location.href = "selectCommodities?curPage=" + curPage +
				"&q=" + q +
				"&sort=" + sort +
				"&classify=" + classify +
				"&choose=" + 1;
			}
			
			function next(curPage) {
				var q = $("#q").val();
				var sort = $("#sort").find("option:selected").val();
				var classify = $("#goodsClassify").find("option:selected").val();
				location.href = "selectCommodities?curPage=" + curPage +
				"&q=" + q +
				"&sort=" + sort +
				"&classify=" + classify +
				"&choose=" + 2;
			}

			function addChoiceGoods(numIid, type) {
				location.href = "addChoiceGoods?numIid=" + numIid + "&type=" + type;
			}
			function addGoodGoods(numIid) {
				location.href = "addGoodGoods?numIid=" + numIid;
			}
			function addChoiceList(numIid) {
				location.href = "addChoiceList?numIid=" + numIid;
			}
			function addTbkBrandList(numIid) {
				location.href = "addTbkBrandList?numIid=" + numIid;
			}
			</script>
		</div>
	</div>

	<!-- jQuery -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
	<!-- layui -->
	<script src="<%=basePath%>vendors/layui/layui.js"></script>
</body>
</html>